// pages/reject/reject.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        name: '小明',
        reason: '1',
        id: 0,
        sessionID:''
    },
    gotoApplication(e){
      wx.request({
        url: 'https://www.hschuangsai.com/message/reply',
        data: {
          "id": this.data.id,
          "reason": this.data.reason,
          "status": "REFUSE"
        },
        header: {
          'content-type': 'application/json',
          'session': this.data.sessionID
        },
        method: "POST",
        success: (result) => {
          if(result.data.code != 0){
            wx.showToast({
              title: result.data.commonErrorCode.errorSuggestion,
              icon: 'none'
            })
          }else{
            wx.showToast({
              title: '操作成功',
            })
            wx.switchTab({
              url: '/pages/project/project'
            })
         }
        },
      })
    },

    gotoDetail(e){
        wx.redirectTo({
          url: '/pages/project/applicationInDetail/applicationInDetail?massageId='+this.data.id+'&status=0',
        })
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
      this.setData({
        id: options.messageId,
        reason: options.reason,
        name: options.name,
        sessionID: wx.getStorageSync('sessionID')
      })
      //console.log(this.data.reason)
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
})